package com.gpframework.common.enums;

import lombok.Getter;

/**
 * 场地枚举
 *
 * @author BrinedFish
 * @create 2022-04-28 15:34
 */
@Getter
public enum CommonRegionEnum {

    // 场地座位状态
    UNDER_REPAIR("维修中", "0"),
    DEACTIVATE("停用", "1"),
    ENABLE("启用", "2"),
    // 排课座位状态
    SEAT_STATE_UNDER_REPAIR("维修中", "0"),
    SEAT_STATE_NO_APPOINTMENT("未预约", "1"),
    SEAT_STATE_ALREADY_APPOINTMENT("已预约", "2"),
    //场地类型
    BUSINESS_CABINET("租赁柜", "10");
    /**
     * 业务名称
     */
    private String name;

    private String key;

    private CommonRegionEnum() {
    }

    private CommonRegionEnum(String name) {
        this.name = name;
    }

    private CommonRegionEnum(String name, String key) {
        this.name = name;
        this.key = key;
    }

    // 通过key获取枚举
    public static CommonRegionEnum getEnumByKey(String key) {
        CommonRegionEnum result = null;
        for (CommonRegionEnum value : values()) {
            if (value.getKey().equals(key)) {
                result = value;
                break;
            }
        }
        return result;
    }

}
